package com.example.okhttp;

import javafx.scene.chart.ValueAxis;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/okhttp")
public class OkHttpController {


    @GetMapping(value = "/get")
    public String get(String name,String key){
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("name:"+name);
        System.out.println("key:"+key);
        return "get is OK";
    }

    @PostMapping(value = "/post")
    public String post(String name,String key){
        System.out.println("name:"+name);
        System.out.println("key:"+key);
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "post is ok";
    }

}
